<?php 
include ("../../checkuser.php"); 
//error_reporting(0);
include "include/kopf.php";
include "include/menu.php";
include "../../conf.php";
?> 
<!-- Datensatz eingereicht? -->
<?php
$aid = isset($_GET['aid']) ? $_GET['aid'] : "";

if (isset($_POST['submit'])) 
{
$sql = "UPDATE adressen SET  vorname='".$_POST['vorname']."',nachname='".$_POST['nachname']."',strasse='".$_POST['strasse']."',plz='".$_POST['plz']."',ort='".$_POST['ort']."',telefon='".$_POST['telefon']."',kat='".$_POST['kat']."',handy='".$_POST['handy']."' WHERE id='".$_POST["aid"]."'";
$result = mysql_query($sql,$connect);
?>
  <td>
    <br>Adresse wurde ge&auml;ndert<br>
  </td>
<?php
exit();
}

$query = "Select * from adressen where id=$aid";
$result = mysql_query($query) or die ("MySQL-Fehler: " . mysql_error());
while($myrow = mysql_fetch_assoc($result))
{
?>
<td valign="top">
  <table style="font-family: Verdana,Arial,sans-serif;    
    font-style:       normal;
    font-size:        11px;
    BORDER-TOP:       #A6A6A6 1px solid; 
    BORDER-LEFT:      #A6A6A6 1px solid; 
    BORDER-BOTTOM:    #A6A6A6 1px solid;
    BORDER-RIGHT:     #A6A6A6 1px solid;">
    <tr>
      <td><b>Benutzer bearbeiten</b></td>
    </tr>
      <form name="meins" method="post" action="<?php echo $HTTP_SERVER_VARS['PHP_SELF'] ?>">
    <tr>
      <td>Vorname:</td>
      <td><input name="vorname" type="text" size="20" maxlength="100" value="<?PHP echo $myrow['vorname']; ?>"></td>
     </tr>
    <tr>
      <td>Nachname:</td>
      <td><input name="nachname" type="text" size="20" maxlength="100" value="<?PHP echo $myrow['nachname']; ?>"></td>
    </tr>
    <tr>
      <td>Stra&szlig;e:</td>
      <td><input name="strasse" type="text" size="20" maxlength="100" value="<?PHP echo $myrow['strasse']; ?>"></td>
    </tr>
        <tr>
      <td>Plz:</td>
      <td><input name="plz" type="text" size="20" maxlength="100" value="<?PHP echo $myrow['plz']; ?>"></td>
    </tr>
        <tr>
      <td>Ort:</td>
      <td><input name="ort" type="text" size="20" maxlength="100" value="<?PHP echo $myrow['ort']; ?>"></td>
    </tr>
        <tr>
      <td>Telefon:</td>
      <td><input name="telefon" type="text" size="20" maxlength="100" value="<?PHP echo $myrow['telefon']; ?>"></td>
    </tr>
         <td>Handy:</td>
      <td><input name="handy" type="text" size="20" maxlength="100" value="<?PHP echo $myrow['handy']; ?>"></td>
    </tr>
    <tr><td></td>
    <td>
    
       <!-- Kategorie zuweisen --> 
  	<select name="kat" size="1"> 
    <option value="<?php echo $myrow['kat']; ?>"><?php echo $myrow['kat']; ?></option>
<?php 
   $result = mysql_query("SELECT * FROM menu ORDER BY reihe ASC",$connect);
while($table=mysql_fetch_array($result))
{
?>
<option value="<?php echo $table['name']; ?>"><?php echo $table['name']; ?></option>
<?php  
}
  ?>
  <option value="Allgemein">Allgemein</option> 
</select>
    
    </td>
<tr>
<input name="aid" type="hidden" value="<?php echo $myrow['id']; ?>">
<tr>
      <td></td>
      <td><input style="margin-left:1.5em" name="submit" type="submit" value=" Adresse &auml;ndern "></td>
    <tr>
  </table>
</td>
<?php
}
?>
</tr>
</table>
</body> 
</html>